<?php
session_start();

 function printPage($title,$content)
{
	return '
				<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title>'.$title.'</title>
		'.includeHeader().'
		

	</head>
	<body style="padding-bottom: 50px;" onload="timedCount()">
		<div class="container">
			<div class="span3" style="margin-bottom:50px; margin-left:0px">
					
				
			</div>	
			'.includeMenu().'
		</div>
		<div class="container thumbnail">
			<div class="row-fluid">
				<div class="span12" style="height:15px">
				</div>
				
				'.includeProfile().'
				
				<div class="span9">
					'.$content.'
				</div>
			</div>
			<div class="btn disabled btn-block" style="margin-bottom: 0px;">
					Recoded by Najamuddin dwi @praktikumBDL ; 2013
				</a>
			</div>
		</div>
		

		'.includeFooter().'
		
	</body>
</html>
		
			';

}
function includeHeader()
{
	return'<meta name="viewport" content="width=device-width, initial-scale=1.0">
			<meta name="description" content="">
			<meta name="author" content="">

			<!-- main styles -->
				<link rel="stylesheet" href="headmaster/css/style.css" />

			<!-- Le styles -->
			<link href="assets/css/bootstrap.css" rel="stylesheet">
			<!--
			<style type="text/css">
				  body {
					padding-top: 60px;
					padding-bottom: 40px;
				  }
			</style>
			-->
			<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
			<link href="assets/css/mystyle.css" rel="stylesheet">
			 <link rel="stylesheet" href="assets/jBreadcrumbs/css/BreadCrumb.css" />
			<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
			<!--[if lt IE 9]>
				  <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
				<![endif]-->
			<!-- Fav and touch icons -->
			<link rel="shortcut icon" href="assets/ico/avatar2.jpg">
			<!--<link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/ico/apple-touch-icon-144-precomposed.png">
			<link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/ico/apple-touch-icon-114-precomposed.png">
			<link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/ico/apple-touch-icon-72-precomposed.png">
			<link rel="apple-touch-icon-precomposed" href="assets/ico/apple-touch-icon-57-precomposed.png">-->
			<!-- colorbox -->
			<script src="assets/js/jquery.js"></script>
			<script src="jquery.colorbox.js"></script>
			<link rel="stylesheet" href="colorbox.css" />
			<link rel="stylesheet" href="treeview.css" />
			<script>
				$(document).ready(function () {
					//$("#cari").hide();
					$("#jCrumbs").jBreadCrumb({
							endElementsToLeaveOpen: 0,
							beginingElementsToLeaveOpen: 0,
							timeExpansionAnimation: 500,
							timeCompressionAnimation: 500,
							timeInitialCollapse: 500,
							previewWidth: 30
						});
						//colorbox
						$(".show").colorbox({width:600,height:400});
				});
			</script>		

			<script type="text/javascript">
				var c=0;
				var t;

				function loadXMLDoc()
				{
					var xmlhttp;
					if (window.XMLHttpRequest)
					{// code for IE7+, Firefox, Chrome, Opera, Safari
						xmlhttp=new XMLHttpRequest();
					}
					else
					{// code for IE6, IE5
						xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
					}
					  
					xmlhttp.onreadystatechange=function()
					{
						if (xmlhttp.readyState==4 && xmlhttp.status==200)
						{
							document.getElementById("jam").innerHTML=xmlhttp.responseText;
						}
					}
					
					//proses update direquest ke file .php
					xmlhttp.open("GET","jam.php",true);
					xmlhttp.send();
				}

				function timedCount()
				{
					//proses update direfresh per 60 detik lewat ajax
					loadXMLDoc();
					t=setTimeout("timedCount()",1000);
				}

			</script>
			
			</style>
				<link rel="stylesheet" href="colorboxfile/colorbox.css" />
				<script src="colorboxfile/jquery.min.js"></script>
				<script src="colorboxfile/jquery.colorbox.js"></script>
				<script>
					$(document).ready(function(){
						//Examples of how to assign the Colorbox event to elements			
						$(".group4").colorbox({rel:"group4", slideshow:true});
						$(".ajax").colorbox();
						$(".callbacks").colorbox({
							onOpen:function(){ alert("onOpen: colorbox is about to open"); },
							onLoad:function(){ alert("onLoad: colorbox has started to load the targeted content"); },
							onComplete:function(){ alert("onComplete: colorbox has displayed the loaded content"); },
							onCleanup:function(){ alert("onCleanup: colorbox has begun the close process"); },
							onClosed:function(){ alert("onClosed: colorbox has completely closed"); }
						});

						$(".non-retina").colorbox({rel:"group5", transition:"none"})
						$(".retina").colorbox({rel:"group5", transition:"none", retinaImage:true, retinaUrl:true});
						
						//Example of preserving a JavaScript event for inline calls.
						$("#click").click(function(){ 
							$("#click").css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
							return false;
						});
					});
				</script>				
			';
}
/////////////////////////profile////////////////////////////
function includeProfile()
{
	return'
			<div class="span3" style="margin-bottom:10px; margin-left:0px">
				<div class="span12">
					<div class="span2">					
					</div>
					<div class="span8" >
						
					</div>
					<div class="span2">					
					</div>
				</div>
				<div class="spand12">						
						<ul class="thumbnails row-fluid"  style="margin-bottom: 0px;">
							<li class="span12 thumbnail"  style="min-height:100px;margin-bottom: 0px;margin-left:0px;" >					
								<!--<a href="carddisplay.php?id=112">-->
									<div align="center" class="" 
										style="text-align:center;font-size:9pt;padding: 3px 3px 0px;max-width:175px;margin-left:auto;margin-right:auto">							
											<img src="avatar.jpg" width="304" height="228">
									</div>
								<!--</a>-->
							</li>
						</ul>
						<div style="margin:0px;align:center;font-size:15pt;margin-top:0px;margin-bottom:0px;padding-top: 4px; padding-bottom: 4px;" class="legend alert alert-info">
							<b>
							'.					
								includeCekProfileTitle()
								.'
								
							</b>
						</div>
				</div>
				<div class="spand12">
						<div style="margin:0px;align:center;font-size:15pt;margin-top:10px;margin-bottom:2px;padding-top: 4px; padding-bottom: 4px;" class="legend alert alert-info">
							<b>
								'.includeAjaxJam().'
							</b>
						</div>
						<ul class="thumbnails row-fluid"  style="margin-bottom: 0px;">
							<li class="span12 thumbnail"  style="min-height:100px;margin-bottom: 10px;margin-left:0px;" >					
								<!--<a href="carddisplay.php?id=112">-->
									<div align="center" class="" 
										style="text-align:center;font-size:12pt;padding: 3px 3px 0px;margin-left:auto;margin-right:auto">							
										
									</div>
								<!--</a>-->
							</li>
						</ul>
				</div>
			</div>
			';
}

function includeCekProfileTitle()
{
	if(isset($_SESSION['levelUser']))
		{
			$profiletitle="Selamat Datang";
		}
	else
		{
			$profiletitle="welcome manager";
		}
	return $profiletitle;
}

function includeCekProfilecontent()
{
	if(isset($_SESSION['levelUser']))
		{
			$profiletitle="Profile Praktikan";
		}
	else
		{
			$profiletitle='<div class="span12">
							    <table class="table" class="spand12" border="1">
										<tr>
												<td>
													nama
												</td>
												<td>
													<input type="text" name="nama">
												</td>
										</tr>
										<tr>
												<td>
													password
												</td>
												<td>
													<input type="text" name="password">
												</td>
										</tr>
										<tr>
												<td>
													
												</td>
												<td>
													<input type="button" >
												</td>
										</tr>
									</table>
							</div>
							';
		}
	return $profiletitle;
}
/////////////////profile//////////////////////////
	//<li'. setActiveMenu('about.php').' ><a href="about.php"><i class="icon-tags "></i>About Us</a></li>
function includeMenu()
{
	return '
			<div class="row-fluid" >
			<div class="navbar navbar-fixed-top">
			<div class="navbar-inner">
				<div class="container">
					<ul class="nav nav-pills span12">
						<li'. setActiveMenu('home.php').'><a href="home.php"><i class="icon-home "></i>Beranda</a></li>						
						<li'. setActiveMenu('laporan.php').'><a href="laporan.php"><i class="icon-home "></i>Laporan</a></li>
						<li'. setActiveMenu('logout.php').'><a href="logout.php"><i class="icon-home "></i>Keluar</a></li>
					</ul>
				</div>
			</div>
			</div>
			</div>
			';
}
function includeFooter()
{
	return '
			<!-- Le javascript
				================================================== -->
			<!-- Placed at the end of the document so the pages load faster -->
			<script src="assets/js/bootstrap-transition.js"></script>
			<script src="assets/jBreadcrumbs/js/jquery.jBreadCrumb.1.1.min.js"></script>
			<script src="assets/js/bootstrap-alert.js"></script>
			<script src="assets/js/bootstrap-modal.js"></script>
			<script src="assets/js/bootstrap-dropdown.js"></script>
			<script src="assets/js/bootstrap-scrollspy.js"></script>
			<script src="assets/js/bootstrap-tab.js"></script>
			<script src="assets/js/bootstrap-tooltip.js"></script>
			<script src="assets/js/bootstrap-popover.js"></script>
			<script src="assets/js/bootstrap-button.js"></script>
			<script src="assets/js/bootstrap-collapse.js"></script>
			<script src="assets/js/bootstrap-carousel.js"></script>
			<script src="assets/js/bootstrap-typeahead.js"></script>

			<script src="headmaster/js/jquery.min.js"></script>
			<!-- smart resize event -->
			<script src="headmaster/js/jquery.debouncedresize.min.js"></script>
			<!-- hidden elements width/height -->
			<script src="headmaster/js/jquery.actual.min.js"></script>
			<!-- js cookie plugin -->
			<script src="headmaster/js/jquery.cookie.min.js"></script>
			<!-- main bootstrap js -->
			<script src="headmaster/bootstrap/js/bootstrap.min.js"></script>
			<!-- bootstrap plugins -->
			<script src="headmaster/js/bootstrap.plugins.min.js"></script>
			<!-- tooltips -->
			<script src="headmaster/lib/qtip2/jquery.qtip.min.js"></script>
			<!-- jBreadcrumbs -->
			<script src="headmaster/lib/jBreadcrumbs/js/jquery.jBreadCrumb.1.1.min.js"></script>
			<!-- sticky messages -->
			<script src="headmaster/lib/sticky/sticky.min.js"></script>
			<!-- fix for ios orientation change -->
			<script src="headmaster/js/ios-orientationchange-fix.js"></script>
			<!-- scrollbar -->
			<script src="headmaster/lib/antiscroll/antiscroll.js"></script>
			<script src="headmaster/lib/antiscroll/jquery-mousewheel.js"></script>
			<!-- common functions -->
			<script src="headmaster/js/gebo_common.js"></script>

			<!-- colorbox -->
			<script src="headmaster/lib/colorbox/jquery.colorbox.min.js"></script><!-- datatable -->
			<script src="headmaster/lib/datatables/jquery.dataTables.min.js"></script>
			<!-- additional sorting for datatables -->
			<script src="headmaster/lib/datatables/jquery.dataTables.sorting.js"></script>
			<!-- tables functions -->
			<script src="headmaster/js/gebo_tables.js"></script>
			<!-- form functions -->
            <script src="js/gebo_forms.js"></script>
            
			<script>
				$(document).ready(function() {
					//* show all elements & remove preloader
					setTimeout(\'$("html").removeClass("js")\',1000);
				});
				
				//* bootstrap datepicker
			
			</script>
			
			'.
			"
				<script>
					$(function(){
						window.prettyPrint && prettyPrint();
						$('#dp1').datepicker({
							format: 'mm-dd-yyyy'
						});
						$('#dp2').datepicker();
						$('#dp3').datepicker();
						$('#dp3').datepicker();
						$('#dpYears').datepicker();
						$('#dpMonths').datepicker();
						
						
						var startDate = new Date(2012,1,20);
						var endDate = new Date(2012,1,25);
						$('#dp4').datepicker()
							.on('changeDate', function(ev){
								if (ev.date.valueOf() > endDate.valueOf()){
									$('#alert').show().find('strong').text('The start date can not be greater then the end date');
								} else {
									$('#alert').hide();
									startDate = new Date(ev.date);
									$('#startDate').text($('#dp4').data('date'));
								}
								$('#dp4').datepicker('hide');
							});
						$('#dp5').datepicker()
							.on('changeDate', function(ev){
								if (ev.date.valueOf() < startDate.valueOf()){
									$('#alert').show().find('strong').text('The end date can not be less then the start date');
								} else {
									$('#alert').hide();
									endDate = new Date(ev.date);
									$('#endDate').text($('#dp5').data('date'));
								}
								$('#dp5').datepicker('hide');
							});

					// disabling dates
					var nowTemp = new Date();
					var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);

					var checkin = $('#dpd1').datepicker({
					  onRender: function(date) {
						return date.valueOf() < now.valueOf() ? 'disabled' : '';
					  }
					}).on('changeDate', function(ev) {
					  if (ev.date.valueOf() > checkout.date.valueOf()) {
						var newDate = new Date(ev.date)
						newDate.setDate(newDate.getDate() + 1);
						checkout.setValue(newDate);
					  }
					  checkin.hide();
					  $('#dpd2')[0].focus();
					}).data('datepicker');
					var checkout = $('#dpd2').datepicker({
					  onRender: function(date) {
						return date.valueOf() <= checkin.date.valueOf() ? 'disabled' : '';
					  }
					}).on('changeDate', function(ev) {
					  checkout.hide();
					}).data('datepicker');
					});
				</script>
			";
}

//koding untuk mengsetmenu menjadi aktif
function setActiveMenu($pageName)
{
	if(getCurrentPageName()==$pageName)
	{
		return ' class="active" ';
	}
	else
	{
		return '';
	}
}

//koding untuk mencari nama file sekarang
function getCurrentPageName() 
{
	return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
}
//ajax jam
function includeAjaxJam()
{
	return'<div id="jam">
				
			</div>';
}



//tampilan update////////////////
 function printPageUdate($content)
{
	return '
				<html>
					<head>
					</head>
					<body>
						<div id="homer" style="  width:500px; padding:30px 10px;">
							'.$content.'
						</div>
					</body>
				</html>
			';
}			
?>
